package com.medical.medical.service;

import com.medical.medical.entity.Review;
import com.medical.medical.mapper.ReviewMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @authorDesc 你相信光吗？
 * @author GUOYN
 * @date 2022-09-14 09:49:50
 * @version 1.0.0
 * @description 公告业务逻辑层实现类
 */
@Slf4j
@Service
public class ReviewServiceImpl implements ReviewService{
    @Resource
    private ReviewMapper reviewMapper;

    @Override
     /**
      *@author WangLuDong
      *@Description 方法描述 获取所有评论
      *@Date 2022-09-14 16:04:31
      *@Return {@link List< Review>}
      */
    public List<Review> getAllReview() {
        return reviewMapper.getAllReview();
    }

    @Override
     /**
      *@author WangLuDong
      *@Description 方法描述 添加评论
      *@Date 2022-09-14 16:45:27
      *@param review
      *@Return {@link Review}
      */
    public boolean addReview(Review review) {
        log.info("添加评论中...");
        try {
            //int resultInfo = reviewMapper.addReview(viewName,viewTime,viewDesc);
            int resultInfo = reviewMapper.addReview(review);
            return resultInfo > 0;
        } catch (Exception e) {
            e.printStackTrace();
            log.error("添加评论失败");
        }
        return false;
    }
}
